package com.dapeis.web.wx.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import com.ag.web.controller.BaseController;
import com.dapeis.domain.User;
import com.dapeis.web.wx.spring.interceptor.WxOpenIdAuthApiInterceptor;
import com.google.gson.Gson;
import com.google.gson.JsonObject;

/**
 * @author 作者 E-mail:
 * @version 创建时间：2017年4月26日 下午2:58:09 类说明
 */
public class RestController extends BaseController {

    public static User getThreadLocalUser() {
	return WxOpenIdAuthApiInterceptor.userThreadLocal.get();
    }

    public static Integer getThreadLocalUserId() {
	User user = getThreadLocalUser();
	if (user == null)
	    return null;
	return user.getId();
    }

    public static JsonObject success() {
	JsonObject jsonObject = new JsonObject();
	jsonObject.addProperty("succ", true);
	jsonObject.addProperty("msg", "操作成功!");
	return jsonObject;
    }

}
